package cn.minsh.lims.eoms.modules.app.controller;

import cn.minsh.lims.eoms.common.utils.PageUtils;
import cn.minsh.lims.eoms.common.utils.R;
import cn.minsh.lims.eoms.modules.app.entity.UserInspectionPlanScopeEntity;
import cn.minsh.lims.eoms.modules.app.service.UserInspectionPlanScopeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 用户巡检范围
 *
 * @author lht
 * @email sunlightcs@gmail.com
 * @date 2021-04-26 02:30:42
 */
@RestController
@RequestMapping("sys/userInspectionPlanScope")
public class UserInspectionPlanScopeController {
    @Autowired
    private UserInspectionPlanScopeService userInspectionPlanScopeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("sys:userinspectionplanscope:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userInspectionPlanScopeService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("sys:userinspectionplanscope:info")
    public R info(@PathVariable("id") Long id){
		UserInspectionPlanScopeEntity userInspectionPlanScope = userInspectionPlanScopeService.getById(id);

        return R.ok().put("userInspectionPlanScope", userInspectionPlanScope);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("sys:userinspectionplanscope:save")
    public R save(@RequestBody UserInspectionPlanScopeEntity userInspectionPlanScope){
		userInspectionPlanScopeService.save(userInspectionPlanScope);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("sys:userinspectionplanscope:update")
    public R update(@RequestBody UserInspectionPlanScopeEntity userInspectionPlanScope){
		userInspectionPlanScopeService.updateById(userInspectionPlanScope);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("sys:userinspectionplanscope:delete")
    public R delete(@RequestBody Long[] ids){
		userInspectionPlanScopeService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
